3.1.13 \(\int \frac {(A+B x) (a+b x+c x^2)}{d+e x+f x^2} \, dx\) [13]

Optimal. Leaf size=184 \[ -\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}-\frac {\left (A f \left (c e^2-2 c d f-b e f+2 a f^2\right )+B \left (f \left (b e^2-2 b d f-a e f\right )-c \left (e^3-3 d e f\right )\right )\right ) \tanh ^{-1}\left (\frac {e+2 f x}{\sqrt {e^2-4 d f}}\right )}{f^3 \sqrt {e^2-4 d f}}-\frac {\left (A f (c e-b f)-B \left (c e^2-c d f-b e f+a f^2\right )\right ) \log \left (d+e x+f x^2\right )}{2 f^3} \]

[Out]

-(-A*c*f-B*b*f+B*c*e)*x/f^2+1/2*B*c*x^2/f-1/2*(A*f*(-b*f+c*e)-B*(a*f^2-b*e*f-c*d*f+c*e^2))*ln(f*x^2+e*x+d)/f^3
-(A*f*(2*a*f^2-b*e*f-2*c*d*f+c*e^2)+B*(f*(-a*e*f-2*b*d*f+b*e^2)-c*(-3*d*e*f+e^3)))*arctanh((2*f*x+e)/(-4*d*f+e
^2)^(1/2))/f^3/(-4*d*f+e^2)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.22, antiderivative size = 182, normalized size of antiderivative = 0.99, number of steps used = 6, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {1642, 648, 632, 212, 642} \begin {gather*} -\frac {\log \left (d+e x+f x^2\right ) \left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right )}{2 f^3}-\frac {\tanh ^{-1}\left (\frac {e+2 f x}{\sqrt {e^2-4 d f}}\right ) \left (A f \left (2 a f^2-b e f-2 c d f+c e^2\right )+B f \left (-a e f-2 b d f+b e^2\right )-B c \left (e^3-3 d e f\right )\right )}{f^3 \sqrt {e^2-4 d f}}-\frac {x (-A c f-b B f+B c e)}{f^2}+\frac {B c x^2}{2 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((A + B*x)*(a + b*x + c*x^2))/(d + e*x + f*x^2),x]

[Out]

-(((B*c*e - b*B*f - A*c*f)*x)/f^2) + (B*c*x^2)/(2*f) - ((B*f*(b*e^2 - 2*b*d*f - a*e*f) - B*c*(e^3 - 3*d*e*f) +
 A*f*(c*e^2 - 2*c*d*f - b*e*f + 2*a*f^2))*ArcTanh[(e + 2*f*x)/Sqrt[e^2 - 4*d*f]])/(f^3*Sqrt[e^2 - 4*d*f]) - ((
B*f*(b*e - a*f) + A*f*(c*e - b*f) - B*c*(e^2 - d*f))*Log[d + e*x + f*x^2])/(2*f^3)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 1642

Int[(Pq_)*((d_.) + (e_.)*(x_))^(m_.)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegra
nd[(d + e*x)^m*Pq*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rubi steps

\begin {align*} \int \frac {(A+B x) \left (a+b x+c x^2\right )}{d+e x+f x^2} \, dx &=\int \left (-\frac {B c e-b B f-A c f}{f^2}+\frac {B c x}{f}+\frac {-A f (c d-a f)+B d (c e-b f)-\left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right ) x}{f^2 \left (d+e x+f x^2\right )}\right ) \, dx\\ &=-\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}+\frac {\int \frac {-A f (c d-a f)+B d (c e-b f)-\left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right ) x}{d+e x+f x^2} \, dx}{f^2}\\ &=-\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}+\frac {\left (-B f (b e-a f)-A f (c e-b f)+B c \left (e^2-d f\right )\right ) \int \frac {e+2 f x}{d+e x+f x^2} \, dx}{2 f^3}+\frac {\left (B f \left (b e^2-2 b d f-a e f\right )-B c \left (e^3-3 d e f\right )+A f \left (c e^2-2 c d f-b e f+2 a f^2\right )\right ) \int \frac {1}{d+e x+f x^2} \, dx}{2 f^3}\\ &=-\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}-\frac {\left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right ) \log \left (d+e x+f x^2\right )}{2 f^3}-\frac {\left (B f \left (b e^2-2 b d f-a e f\right )-B c \left (e^3-3 d e f\right )+A f \left (c e^2-2 c d f-b e f+2 a f^2\right )\right ) \text {Subst}\left (\int \frac {1}{e^2-4 d f-x^2} \, dx,x,e+2 f x\right )}{f^3}\\ &=-\frac {(B c e-b B f-A c f) x}{f^2}+\frac {B c x^2}{2 f}-\frac {\left (B f \left (b e^2-2 b d f-a e f\right )-B c \left (e^3-3 d e f\right )+A f \left (c e^2-2 c d f-b e f+2 a f^2\right )\right ) \tanh ^{-1}\left (\frac {e+2 f x}{\sqrt {e^2-4 d f}}\right )}{f^3 \sqrt {e^2-4 d f}}-\frac {\left (B f (b e-a f)+A f (c e-b f)-B c \left (e^2-d f\right )\right ) \log \left (d+e x+f x^2\right )}{2 f^3}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.15, size = 175, normalized size = 0.95 \begin {gather*} \frac {2 f (-B c e+b B f+A c f) x+B c f^2 x^2-\frac {2 \left (B f \left (-b e^2+2 b d f+a e f\right )+B c \left (e^3-3 d e f\right )+A f \left (-c e^2+2 c d f+b e f-2 a f^2\right )\right ) \tan ^{-1}\left (\frac {e+2 f x}{\sqrt {-e^2+4 d f}}\right )}{\sqrt {-e^2+4 d f}}+\left (B f (-b e+a f)+A f (-c e+b f)+B c \left (e^2-d f\right )\right ) \log (d+x (e+f x))}{2 f^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[((A + B*x)*(a + b*x + c*x^2))/(d + e*x + f*x^2),x]

[Out]

(2*f*(-(B*c*e) + b*B*f + A*c*f)*x + B*c*f^2*x^2 - (2*(B*f*(-(b*e^2) + 2*b*d*f + a*e*f) + B*c*(e^3 - 3*d*e*f) +
 A*f*(-(c*e^2) + 2*c*d*f + b*e*f - 2*a*f^2))*ArcTan[(e + 2*f*x)/Sqrt[-e^2 + 4*d*f]])/Sqrt[-e^2 + 4*d*f] + (B*f
*(-(b*e) + a*f) + A*f*(-(c*e) + b*f) + B*c*(e^2 - d*f))*Log[d + x*(e + f*x)])/(2*f^3)

________________________________________________________________________________________

Maple [A]
time = 0.21, size = 190, normalized size = 1.03

method result size
default \(\frac {\frac {1}{2} B c \,x^{2} f +A c f x +B b f x -B c e x}{f^{2}}+\frac {\frac {\left (A b \,f^{2}-A c e f +B a \,f^{2}-B b e f -B c d f +B c \,e^{2}\right ) \ln \left (f \,x^{2}+e x +d \right )}{2 f}+\frac {2 \left (A a \,f^{2}-A c d f -B b d f +B c d e -\frac {\left (A b \,f^{2}-A c e f +B a \,f^{2}-B b e f -B c d f +B c \,e^{2}\right ) e}{2 f}\right ) \arctan \left (\frac {2 f x +e}{\sqrt {4 d f -e^{2}}}\right )}{\sqrt {4 d f -e^{2}}}}{f^{2}}\) \(190\)
risch \(\text {Expression too large to display}\) \(8247\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((B*x+A)*(c*x^2+b*x+a)/(f*x^2+e*x+d),x,method=_RETURNVERBOSE)

[Out]

1/f^2*(1/2*B*c*x^2*f+A*c*f*x+B*b*f*x-B*c*e*x)+1/f^2*(1/2*(A*b*f^2-A*c*e*f+B*a*f^2-B*b*e*f-B*c*d*f+B*c*e^2)/f*l
n(f*x^2+e*x+d)+2*(A*a*f^2-A*c*d*f-B*b*d*f+B*c*d*e-1/2*(A*b*f^2-A*c*e*f+B*a*f^2-B*b*e*f-B*c*d*f+B*c*e^2)*e/f)/(
4*d*f-e^2)^(1/2)*arctan((2*f*x+e)/(4*d*f-e^2)^(1/2)))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)*(c*x^2+b*x+a)/(f*x^2+e*x+d),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*d*f-%e^2>0)', see `assume?`
for more det

________________________________________________________________________________________

Fricas [A]
time = 0.43, size = 584, normalized size = 3.17 \begin {gather*} \left [\frac {4 \, B c d f^{3} x^{2} - 8 \, B c d f^{2} x e + 8 \, {\left (B b + A c\right )} d f^{3} x + 2 \, B c f x e^{3} + {\left (2 \, A a f^{3} - 2 \, {\left (B b + A c\right )} d f^{2} - B c e^{3} + {\left (B b + A c\right )} f e^{2} + {\left (3 \, B c d f - {\left (B a + A b\right )} f^{2}\right )} e\right )} \sqrt {-4 \, d f + e^{2}} \log \left (\frac {2 \, f^{2} x^{2} + 2 \, f x e - 2 \, d f + \sqrt {-4 \, d f + e^{2}} {\left (2 \, f x + e\right )} + e^{2}}{f x^{2} + x e + d}\right ) - {\left (B c f^{2} x^{2} + 2 \, {\left (B b + A c\right )} f^{2} x\right )} e^{2} - {\left (4 \, B c d^{2} f^{2} - 4 \, {\left (B a + A b\right )} d f^{3} + 4 \, {\left (B b + A c\right )} d f^{2} e + B c e^{4} - {\left (B b + A c\right )} f e^{3} - {\left (5 \, B c d f - {\left (B a + A b\right )} f^{2}\right )} e^{2}\right )} \log \left (f x^{2} + x e + d\right )}{2 \, {\left (4 \, d f^{4} - f^{3} e^{2}\right )}}, \frac {4 \, B c d f^{3} x^{2} - 8 \, B c d f^{2} x e + 8 \, {\left (B b + A c\right )} d f^{3} x + 2 \, B c f x e^{3} - 2 \, {\left (2 \, A a f^{3} - 2 \, {\left (B b + A c\right )} d f^{2} - B c e^{3} + {\left (B b + A c\right )} f e^{2} + {\left (3 \, B c d f - {\left (B a + A b\right )} f^{2}\right )} e\right )} \sqrt {4 \, d f - e^{2}} \arctan \left (-\frac {2 \, f x + e}{\sqrt {4 \, d f - e^{2}}}\right ) - {\left (B c f^{2} x^{2} + 2 \, {\left (B b + A c\right )} f^{2} x\right )} e^{2} - {\left (4 \, B c d^{2} f^{2} - 4 \, {\left (B a + A b\right )} d f^{3} + 4 \, {\left (B b + A c\right )} d f^{2} e + B c e^{4} - {\left (B b + A c\right )} f e^{3} - {\left (5 \, B c d f - {\left (B a + A b\right )} f^{2}\right )} e^{2}\right )} \log \left (f x^{2} + x e + d\right )}{2 \, {\left (4 \, d f^{4} - f^{3} e^{2}\right )}}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)*(c*x^2+b*x+a)/(f*x^2+e*x+d),x, algorithm="fricas")

[Out]

[1/2*(4*B*c*d*f^3*x^2 - 8*B*c*d*f^2*x*e + 8*(B*b + A*c)*d*f^3*x + 2*B*c*f*x*e^3 + (2*A*a*f^3 - 2*(B*b + A*c)*d
*f^2 - B*c*e^3 + (B*b + A*c)*f*e^2 + (3*B*c*d*f - (B*a + A*b)*f^2)*e)*sqrt(-4*d*f + e^2)*log((2*f^2*x^2 + 2*f*
x*e - 2*d*f + sqrt(-4*d*f + e^2)*(2*f*x + e) + e^2)/(f*x^2 + x*e + d)) - (B*c*f^2*x^2 + 2*(B*b + A*c)*f^2*x)*e
^2 - (4*B*c*d^2*f^2 - 4*(B*a + A*b)*d*f^3 + 4*(B*b + A*c)*d*f^2*e + B*c*e^4 - (B*b + A*c)*f*e^3 - (5*B*c*d*f -
 (B*a + A*b)*f^2)*e^2)*log(f*x^2 + x*e + d))/(4*d*f^4 - f^3*e^2), 1/2*(4*B*c*d*f^3*x^2 - 8*B*c*d*f^2*x*e + 8*(
B*b + A*c)*d*f^3*x + 2*B*c*f*x*e^3 - 2*(2*A*a*f^3 - 2*(B*b + A*c)*d*f^2 - B*c*e^3 + (B*b + A*c)*f*e^2 + (3*B*c
*d*f - (B*a + A*b)*f^2)*e)*sqrt(4*d*f - e^2)*arctan(-(2*f*x + e)/sqrt(4*d*f - e^2)) - (B*c*f^2*x^2 + 2*(B*b +
A*c)*f^2*x)*e^2 - (4*B*c*d^2*f^2 - 4*(B*a + A*b)*d*f^3 + 4*(B*b + A*c)*d*f^2*e + B*c*e^4 - (B*b + A*c)*f*e^3 -
 (5*B*c*d*f - (B*a + A*b)*f^2)*e^2)*log(f*x^2 + x*e + d))/(4*d*f^4 - f^3*e^2)]

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 1260 vs. \(2 (175) = 350\).
time = 7.62, size = 1260, normalized size = 6.85 \begin {gather*} \frac {B c x^{2}}{2 f} + x \left (\frac {A c}{f} + \frac {B b}{f} - \frac {B c e}{f^{2}}\right ) + \left (- \frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \cdot \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right ) \log {\left (x + \frac {- A a e f^{2} + 2 A b d f^{2} - A c d e f + 2 B a d f^{2} - B b d e f - 2 B c d^{2} f + B c d e^{2} - 4 d f^{3} \left (- \frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \cdot \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right ) + e^{2} f^{2} \left (- \frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \cdot \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right )}{- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}} \right )} + \left (\frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \cdot \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right ) \log {\left (x + \frac {- A a e f^{2} + 2 A b d f^{2} - A c d e f + 2 B a d f^{2} - B b d e f - 2 B c d^{2} f + B c d e^{2} - 4 d f^{3} \left (\frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \cdot \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right ) + e^{2} f^{2} \left (\frac {\sqrt {- 4 d f + e^{2}} \left (- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}\right )}{2 f^{3} \cdot \left (4 d f - e^{2}\right )} + \frac {A b f^{2} - A c e f + B a f^{2} - B b e f - B c d f + B c e^{2}}{2 f^{3}}\right )}{- 2 A a f^{3} + A b e f^{2} + 2 A c d f^{2} - A c e^{2} f + B a e f^{2} + 2 B b d f^{2} - B b e^{2} f - 3 B c d e f + B c e^{3}} \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)*(c*x**2+b*x+a)/(f*x**2+e*x+d),x)

[Out]

B*c*x**2/(2*f) + x*(A*c/f + B*b/f - B*c*e/f**2) + (-sqrt(-4*d*f + e**2)*(-2*A*a*f**3 + A*b*e*f**2 + 2*A*c*d*f*
*2 - A*c*e**2*f + B*a*e*f**2 + 2*B*b*d*f**2 - B*b*e**2*f - 3*B*c*d*e*f + B*c*e**3)/(2*f**3*(4*d*f - e**2)) + (
A*b*f**2 - A*c*e*f + B*a*f**2 - B*b*e*f - B*c*d*f + B*c*e**2)/(2*f**3))*log(x + (-A*a*e*f**2 + 2*A*b*d*f**2 -
A*c*d*e*f + 2*B*a*d*f**2 - B*b*d*e*f - 2*B*c*d**2*f + B*c*d*e**2 - 4*d*f**3*(-sqrt(-4*d*f + e**2)*(-2*A*a*f**3
 + A*b*e*f**2 + 2*A*c*d*f**2 - A*c*e**2*f + B*a*e*f**2 + 2*B*b*d*f**2 - B*b*e**2*f - 3*B*c*d*e*f + B*c*e**3)/(
2*f**3*(4*d*f - e**2)) + (A*b*f**2 - A*c*e*f + B*a*f**2 - B*b*e*f - B*c*d*f + B*c*e**2)/(2*f**3)) + e**2*f**2*
(-sqrt(-4*d*f + e**2)*(-2*A*a*f**3 + A*b*e*f**2 + 2*A*c*d*f**2 - A*c*e**2*f + B*a*e*f**2 + 2*B*b*d*f**2 - B*b*
e**2*f - 3*B*c*d*e*f + B*c*e**3)/(2*f**3*(4*d*f - e**2)) + (A*b*f**2 - A*c*e*f + B*a*f**2 - B*b*e*f - B*c*d*f
+ B*c*e**2)/(2*f**3)))/(-2*A*a*f**3 + A*b*e*f**2 + 2*A*c*d*f**2 - A*c*e**2*f + B*a*e*f**2 + 2*B*b*d*f**2 - B*b
*e**2*f - 3*B*c*d*e*f + B*c*e**3)) + (sqrt(-4*d*f + e**2)*(-2*A*a*f**3 + A*b*e*f**2 + 2*A*c*d*f**2 - A*c*e**2*
f + B*a*e*f**2 + 2*B*b*d*f**2 - B*b*e**2*f - 3*B*c*d*e*f + B*c*e**3)/(2*f**3*(4*d*f - e**2)) + (A*b*f**2 - A*c
*e*f + B*a*f**2 - B*b*e*f - B*c*d*f + B*c*e**2)/(2*f**3))*log(x + (-A*a*e*f**2 + 2*A*b*d*f**2 - A*c*d*e*f + 2*
B*a*d*f**2 - B*b*d*e*f - 2*B*c*d**2*f + B*c*d*e**2 - 4*d*f**3*(sqrt(-4*d*f + e**2)*(-2*A*a*f**3 + A*b*e*f**2 +
 2*A*c*d*f**2 - A*c*e**2*f + B*a*e*f**2 + 2*B*b*d*f**2 - B*b*e**2*f - 3*B*c*d*e*f + B*c*e**3)/(2*f**3*(4*d*f -
 e**2)) + (A*b*f**2 - A*c*e*f + B*a*f**2 - B*b*e*f - B*c*d*f + B*c*e**2)/(2*f**3)) + e**2*f**2*(sqrt(-4*d*f +
e**2)*(-2*A*a*f**3 + A*b*e*f**2 + 2*A*c*d*f**2 - A*c*e**2*f + B*a*e*f**2 + 2*B*b*d*f**2 - B*b*e**2*f - 3*B*c*d
*e*f + B*c*e**3)/(2*f**3*(4*d*f - e**2)) + (A*b*f**2 - A*c*e*f + B*a*f**2 - B*b*e*f - B*c*d*f + B*c*e**2)/(2*f
**3)))/(-2*A*a*f**3 + A*b*e*f**2 + 2*A*c*d*f**2 - A*c*e**2*f + B*a*e*f**2 + 2*B*b*d*f**2 - B*b*e**2*f - 3*B*c*
d*e*f + B*c*e**3))

________________________________________________________________________________________

Giac [A]
time = 2.48, size = 191, normalized size = 1.04 \begin {gather*} \frac {B c f x^{2} + 2 \, B b f x + 2 \, A c f x - 2 \, B c x e}{2 \, f^{2}} - \frac {{\left (B c d f - B a f^{2} - A b f^{2} + B b f e + A c f e - B c e^{2}\right )} \log \left (f x^{2} + x e + d\right )}{2 \, f^{3}} - \frac {{\left (2 \, B b d f^{2} + 2 \, A c d f^{2} - 2 \, A a f^{3} - 3 \, B c d f e + B a f^{2} e + A b f^{2} e - B b f e^{2} - A c f e^{2} + B c e^{3}\right )} \arctan \left (\frac {2 \, f x + e}{\sqrt {4 \, d f - e^{2}}}\right )}{\sqrt {4 \, d f - e^{2}} f^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)*(c*x^2+b*x+a)/(f*x^2+e*x+d),x, algorithm="giac")

[Out]

1/2*(B*c*f*x^2 + 2*B*b*f*x + 2*A*c*f*x - 2*B*c*x*e)/f^2 - 1/2*(B*c*d*f - B*a*f^2 - A*b*f^2 + B*b*f*e + A*c*f*e
 - B*c*e^2)*log(f*x^2 + x*e + d)/f^3 - (2*B*b*d*f^2 + 2*A*c*d*f^2 - 2*A*a*f^3 - 3*B*c*d*f*e + B*a*f^2*e + A*b*
f^2*e - B*b*f*e^2 - A*c*f*e^2 + B*c*e^3)*arctan((2*f*x + e)/sqrt(4*d*f - e^2))/(sqrt(4*d*f - e^2)*f^3)

________________________________________________________________________________________

Mupad [B]
time = 3.85, size = 273, normalized size = 1.48 \begin {gather*} x\,\left (\frac {A\,c+B\,b}{f}-\frac {B\,c\,e}{f^2}\right )-\frac {\ln \left (f\,x^2+e\,x+d\right )\,\left (B\,c\,e^4-4\,A\,b\,d\,f^3-4\,B\,a\,d\,f^3-A\,c\,e^3\,f-B\,b\,e^3\,f+A\,b\,e^2\,f^2+B\,a\,e^2\,f^2+4\,B\,c\,d^2\,f^2+4\,A\,c\,d\,e\,f^2+4\,B\,b\,d\,e\,f^2-5\,B\,c\,d\,e^2\,f\right )}{2\,\left (4\,d\,f^4-e^2\,f^3\right )}-\frac {\mathrm {atan}\left (\frac {e}{\sqrt {4\,d\,f-e^2}}+\frac {2\,f\,x}{\sqrt {4\,d\,f-e^2}}\right )\,\left (B\,c\,e^3-2\,A\,a\,f^3+A\,b\,e\,f^2+2\,A\,c\,d\,f^2+B\,a\,e\,f^2+2\,B\,b\,d\,f^2-A\,c\,e^2\,f-B\,b\,e^2\,f-3\,B\,c\,d\,e\,f\right )}{f^3\,\sqrt {4\,d\,f-e^2}}+\frac {B\,c\,x^2}{2\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((A + B*x)*(a + b*x + c*x^2))/(d + e*x + f*x^2),x)

[Out]

x*((A*c + B*b)/f - (B*c*e)/f^2) - (log(d + e*x + f*x^2)*(B*c*e^4 - 4*A*b*d*f^3 - 4*B*a*d*f^3 - A*c*e^3*f - B*b
*e^3*f + A*b*e^2*f^2 + B*a*e^2*f^2 + 4*B*c*d^2*f^2 + 4*A*c*d*e*f^2 + 4*B*b*d*e*f^2 - 5*B*c*d*e^2*f))/(2*(4*d*f
^4 - e^2*f^3)) - (atan(e/(4*d*f - e^2)^(1/2) + (2*f*x)/(4*d*f - e^2)^(1/2))*(B*c*e^3 - 2*A*a*f^3 + A*b*e*f^2 +
 2*A*c*d*f^2 + B*a*e*f^2 + 2*B*b*d*f^2 - A*c*e^2*f - B*b*e^2*f - 3*B*c*d*e*f))/(f^3*(4*d*f - e^2)^(1/2)) + (B*
c*x^2)/(2*f)

________________________________________________________________________________________